package com.ykq.system.controller;

import com.ykq.common.vo.Result;
import com.ykq.system.service.AclRoleService;
import com.ykq.system.vo.FenRoleVo;
import com.ykq.system.vo.RoleVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: qy156-education-cloud
 * @description:
 * @author: 闫克起2
 * @create: 2022-12-05 14:42
 **/
@RestController
@RequestMapping("/system/role")
@Api(tags = "角色的API接口类")
public class AclRoleController {

    @Autowired
    private AclRoleService roleService;
    @GetMapping("findRoleByUserId/{userid}")
    public Result findRoleByUserId(@PathVariable Long userid){
        return roleService.findRoleByUserId(userid);
    }

    @PostMapping("/fenUserRole")
    public Result fenUserRole(@RequestBody FenRoleVo fenRoleVo){
        return roleService.fenUserRole(fenRoleVo);
    }

    @ApiOperation(value = "根据条件分页查询角色信息")
    @ApiImplicitParams({
             @ApiImplicitParam(name = "current",value = "当前页码"),
             @ApiImplicitParam(name = "pageSize",value = "每页显示的条数")
    })
    @PostMapping("/findRoleByPage/{current}/{pageSize}")
    public Result findRoleByPage(@RequestBody RoleVo roleVo,
                                 @PathVariable Integer current,
                                 @PathVariable Integer pageSize
                                 ){
         return roleService.findByConditionPage(roleVo,current,pageSize);
    }
}
